<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- vfor使用注意 
            1.要为每个元素设置一个唯一的key值 （需要使用 v-bind 缩写 :）
            2.v-for与v-if不要同用
         -->
        <h4>对象</h4>
        <ul>
            <li v-for="(item,key,index) in person" :key="index">{{index}},{{key}}:&nbsp;{{item}}</li>
        </ul>

        <hr />
        <h2>(significant)数组</h2>
        <ul>
            <li v-for="(item,key) in student">{{key}}:&nbsp;{{item}}</li>
        </ul>

        <hr />
        <h4>数组内的对象</h4>
        <ul>
            <li v-for="(item,key) in personinfo">{{key}}:&nbsp;{{item.name}}</li>
        </ul>

        <hr />
        <h4>字符串</h4>
        <ul>
            <li v-for="item in stringmsg">{{item}}</li>
        </ul>

        <hr />
        <h4>数字</h4>
        <span v-for="item in 10">{{item}}</span>

        <hr /> 
        <!-- 注意template元素不能用 v-bind绑定数据 属性 -->
        <template v-for="item in 3">
            <h4 :key="item + 'a'">hello</h4>
            <h4 :key="item + 'b'">hello</h4>
            <h4 :key="item + 'c'">hello</h4>
            <p>-----</p>
        </template>

    </div>

    <script src="vue.js"></script>
    <script>
        new Vue({
            el:"#app",
            data:function(){
                return {
                    // Object
                    person:{
                        name:"zhangTao",
                        age:"23",
                        othername:"foolishBOY"
                    },

                    // Object in Array
                    personinfo:[
                        {name:"zhangsan"},
                        {name:"zhangsi"},
                        {name:"zhangwu"}
                    ],

                    // Array
                    student:["zh00","zh01","zh02"],

                    stringmsg:"dakkdadajbd"
                }
            },
            methods:{
                a:function(){

                }
            }
        })
    </script>
</body>
</html>